#ifndef TREEGEN3D_H
#define TREEGEN3D_H
#include "treegen.h"
#include "TreeMesh.h"
#include "3DAlgo/shadow3d.h"
#include "spacecol3d.h"
#define ITERATIONS 20

class SpaceCol3D;

class TreeGen3D : public TreeGen
{
public:
    TreeGen3D(Renderer *rend);
    TreeGen3D(); // need to set renderer later if you use this
    void genTree(float2 pos);
    void stupidGen(Bud *b, int depth);
    void auxdirTestGen(Bud *b, int depth);
    void iterateShadowB(Shadow3D *shadowGrid);
    void iterateSpaceColD(SpaceCol3D * spaceCol);
    void updateTree();
    void drawBud(Bud *b);
    Bud *findBud(int index);
    Renderer * render;
    void findBudHelper(Bud *root, int inedx, Bud **targetBud);
    TreeMesh* m_mesh;// = new TreeMesh(treegen);
    TreeGen3D* arrayToTree(vector <float *>);
    TreeGen3D* loadTreeFromFile( QString filename);
    virtual void initializeBud(Bud *b);
    virtual void calculateBranchDiameter(Bud *b);



private:
    float3 findDirection();
    void chooseBudFate();
protected:
};

#endif // TREEGEN3D_H
